package lanou.a36ke_01.fragmengs.equityfragments;

import android.graphics.Color;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import java.util.ArrayList;

import lanou.a36ke_01.adapters.equityadapter.EquityAdapter;
import lanou.a36ke_01.R;
import lanou.a36ke_01.tools.BaseFragment;


public class EquityFragment extends BaseFragment {

    private TabLayout tabLayout;
    private ViewPager viewPager;

    @Override
    protected int setLayout() {
        return R.layout.fragment_equity;
    }

    @Override
    protected void initView() {
        tabLayout = bindView(R.id.equity_fragment_tabLayout);
        viewPager = bindView(R.id.equity_fragment_viewPager);

    }

    @Override
    protected void initData() {
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(new EquityAllFragment());
        fragments.add(new EquityMzzFragment());
        fragments.add(new EquityMzwcFragment());
        fragments.add(new EquityRzwcFragment());

        EquityAdapter equityAdapter = new EquityAdapter(getChildFragmentManager());
        equityAdapter.setFragments(fragments);
        viewPager.setAdapter(equityAdapter);
        tabLayout.setupWithViewPager(viewPager);

        tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
        tabLayout.setSelectedTabIndicatorColor(Color.BLUE);
        tabLayout.setTabTextColors(Color.rgb(0x98,0x9d,0xab),Color.rgb(0x6c,0x8f,0xff));

    }
}
